package protobuf;

import protobuf.clazz.GoodsPicInfo;

import com.google.protobuf.AbstractParser;
import com.google.protobuf.GeneratedMessage;
import com.google.protobuf.InvalidProtocolBufferException;

public class Test {
	public static void main(String[] args) throws InvalidProtocolBufferException {
		GoodsPicInfo.PicInfo.Builder builder=GoodsPicInfo.PicInfo.newBuilder(); 
		builder.setGoodID(100); 
		builder.setGuid("11111-22222-3333-444"); 
		builder.setOrder(0); 
		builder.setType("ITEM"); 
		builder.setID(10); 
		builder.setUrl("http://xxx.jpg"); 
		GoodsPicInfo.PicInfo info=builder.build();
		
		byte[] result=info.toByteArray() ;
//		System.out.println(result.length);
//		GeneratedMessage message=
				
//		GeneratedMessage sss= GoodsPicInfo.PicInfo.getDefaultInstance();
//		sss.getParserForType().parseFrom(result);
//		GoodsPicInfo.PicInfo vv=(PicInfo) sss;
//		System.out.println(vv.getGoodID());
		GoodsPicInfo.PicInfo sssxx=GoodsPicInfo.PicInfo.parseFrom(result);
		System.out.println(sssxx);
//		GoodsPicInfo.PicInfo sss=GoodsPicInfo.PicInfo.getDefaultInstance();
//		//		GoodsPicInfoxx.PicInfoxx.parseFrom(data)
//		System.out.println(sss);
//		GoodsPicInfo.
	}


}
